package net.asg.games.yokeltowers.view;

import net.asg.games.yokeltowers.images.ImageProvider;
import net.asg.games.yokeltowers.sounds.SoundManager;

import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class ThreeColumnYokelGameObject extends ColumnYokelGameObject{
		public ThreeColumnYokelGameObject(ImageProvider imageProvider,
				TextureRegion[] textureRegions, SoundManager soundManager,
				int width, int height, boolean isHitboxActive, BlockYokelGameObject block1,
				BlockYokelGameObject block2, BlockYokelGameObject block3) {
			super(imageProvider, textureRegions, soundManager, width, height * 3,
					isHitboxActive);
			
			block2.rect.setY(block1.rect.y + block1.rect.height);
			block3.rect.setY(block1.rect.y + block1.rect.height * 2);

			addBlock(block1);
			addBlock(block2);
			addBlock(block3);
		}
		
		public void moveDown(float delta, float speedBonus) {
			rect.y -= moveSpeed * delta * speedBonus;
			for (BlockYokelGameObject block : column){
				block.rect.y -= moveSpeed * delta * speedBonus;
			}
		}
		
	    public void cycleDown(){
	    	BlockYokelGameObject tempBlock = column.get(0);
	    	float y = column.get(0).rect.y;
	    	int h = column.get(0).height;
	    	column.set(0, column.get(1));	
	    	column.set(1, column.get(2));
	    	column.set(2, tempBlock);
	    	for (int x = 0; x < column.size; x++){
	    		column.get(x).rect.setY(y + h * x);
	    	}
	    }
	    
	    public void cycleUp(){
	    	BlockYokelGameObject tempBlock = column.get(2);
	    	float y = column.get(0).rect.y;
	    	int h = column.get(0).height;
	    	column.set(2, column.get(1));	
	    	column.set(1, column.get(0));
	    	column.set(0, tempBlock);
	    	for (int x = 0; x < column.size; x++){
	    		column.get(x).rect.setY(y + h * x);
	    	}
	    }    
}
